process non-language pragma nodes in templates #24183
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #24186
When encountering pragma nodes in templates, if it's a language pragma, we don't process the name, and only any values if they exist. If it's not a language pragma, we process the full node. Previously only the values of colon expressions were processed.
To make this simpler,
whichPragma
is patched to consider bracketed hint/warning etc pragmas like{.hint[HintName]: off.}
as being a pragma of kindwHint
rather than an invalid pragma which would have to be checked separately. From looking at the uses ofwhichPragma
this doesn't seem like it would cause problems.Generics have the same problem (causing #18649), but to make it work we need to make sure the templates/macros don't get evaluated or get evaluated correctly (i.e. passing the proc node as the final argument), either with #23094 or by completely disabling template/macro evaluation when processing the pragma node, which would also cover
{.pragma.}
templates.